package com.itheima.controller;

import com.itheima.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class UserController {

    // TODO 测试实体类User参数传递，使用form表单传参
    @RequestMapping ("/save")
    @ResponseBody
    public String save(User user) {
        System.out.println("传递的实体类参数数据为 ==>"+user);
        return "{'module':'pojo param'}";
    }
    // TODO 测试查询id参数传递，使用url地址传参
    @RequestMapping("/getById")
    @ResponseBody
    public String getById(Integer id) {
        System.out.println("要查询的id为 ==> "+id);
        return "{'module':'common param'}";
    }

    // TODO 测试查询条件参数传递，使用form表单传参
    @RequestMapping("/login")
    @ResponseBody
    public String login(String name,String password) {
        System.out.println("用户名： ==> "+name);
        System.out.println("密码： ==> "+password);
        return "{'module':'query condition param'}";
    }

}











